package com.github.hwangrq.myrpc.consumer.controller;

import com.github.hwangrq.myrpc.api.pojo.User;
import com.github.hwangrq.myrpc.api.service.IUserService;
import com.github.hwangrq.myrpc.consumer.anno.RpcReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hwangrq
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @RpcReference
    private IUserService userService;

    @GetMapping("get/{id}")
    public User getUserById(@PathVariable int id) {
        return userService.getUserById(id);
    }
}
